package org.example.mqactual.producer;

import org.apache.rocketmq.common.message.MessageClientIDSetter;
import org.apache.rocketmq.common.message.MessageDecoder;
import org.apache.rocketmq.common.message.MessageId;

import java.net.UnknownHostException;

/**
 * msgid 和 offsetMsgId的编解码
 */
public class MsgIdAndOffsetIdDecoder {

    public static void main(String[] args) throws UnknownHostException {
        //msgId解码
        String ipStrFromID = MessageClientIDSetter.getIPStrFromID("7F000001535018B4AAC25767EDAC0000");
        System.out.println(ipStrFromID);


        //offsetMsgId解码
        MessageId decodeMessageId = MessageDecoder.decodeMessageId("C0A8FE8100002A9F00000000000010CE");
        System.out.println(decodeMessageId.getAddress());
    }
}
